<!DOCTYPE html>
<html lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
<meta name="keywords" content="LightYear,LightYearAdmin,光年,后台模板,后台管理系统,光年HTML模板">
<meta name="description" content="Light Year Admin V5是一个基于Bootstrap v5.1.3的后台管理系统的HTML模板。">
<title>图标选择插件fontIconPicker - 光年(Light Year Admin V4)后台管理系统模板</title>
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<link rel="stylesheet" type="text/css" href="css/materialdesignicons.min.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css"  href="js/fontIconPicker/css/jquery.fonticonpicker.min.css">
<link rel="stylesheet" type="text/css" href="js/fontIconPicker/themes/bootstrap-theme/jquery.fonticonpicker.bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="css/style.min.css">
<style>

</style>
</head>
  
<body>
<div class="container-fluid">

  <div class="row">

  	<div class="col-lg-12">
  	  <div class="card">
  	    <header class="card-header">
  	      <div class="card-title">图标选择插件 fontIconPicker</div>
  	    </header>
  		<div class="card-body">
          
  		  <p>选择后可直接获取选择后的值。例如：<code>$("#icon-example").val();</code></p>
		  <p class="text-danger"><strong>该示例ajax引入v5对应的图标json。</strong></p>
          <input type="text" id="icon-example" name="icon-example" />
          <span id="show-mdi"></span>
          
  	    </div>
  	  </div>
    </div>

  </div>

</div>

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/popper.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/main.min.js"></script>
<script type="text/javascript" src="js/fontIconPicker/jquery.fonticonpicker.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($) {
    var font_element = $('#icon-example').fontIconPicker({
        theme: 'fip-bootstrap'
    });
    
    $.ajax({
        url: './js/fontIconPicker/fontjson/materialdesignicons.json',
        type: 'GET',
        dataType: 'json'
    }).done(function(response) {
 
        var fontello_json_icons = [];
 
        $.each(response.glyphs, function(i, v) {
            fontello_json_icons.push( v.css );
        });
 
        font_element.setIcons(fontello_json_icons);
    }).fail(function() {
        console.error('字体图标配置加载失败');
    });
    
    $(document).on('change', '#icon-example', function(){
        $('#show-mdi').html($(this).val());
    });
});
</script>
</body>
</html>